<template>
  <view>
    <u-navbar title="考试查询" :auto-back="true" />
    <u-toast ref="uToast" />
    <u-loading-page :loading="loading" :iconSize="100" />
    <u-empty v-if="!exan.length" mode="data" icon="https://cdn.uviewui.com/uview/empty/data.png" :marginTop="100" />
  </view>
</template>

<script>
import { getExam } from '@/api'
export default {
  components: {},
  data() {
    return {
      loading: true,
      exan: [],
    }
  },
  computed: {},
  methods: {
    // 考试查询
    async getExam() {
      const { year, term } = uni.$u.currentTerm();
      const { code, message, data } = await getExam({ year, term });
      this.loading = false;
      if (code !== 1000) {
        return this.$refs.uToast.show({
          type: 'error',
          message: message
        });
      }
    },
  },
  watch: {},

  // 页面周期函数--监听页面加载
  onLoad() {
    this.getExam();
  },
  // 页面周期函数--监听页面初次渲染完成
  onReady() {},
  // 页面周期函数--监听页面显示(not-nvue)
  onShow() {},
  // 页面周期函数--监听页面隐藏
  onHide() {},
  // 页面周期函数--监听页面卸载
  onUnload() {},
  // 页面处理函数--监听用户下拉动作
  // onPullDownRefresh() { uni.stopPullDownRefresh(); },
  // 页面处理函数--监听用户上拉触底
  // onReachBottom() {},
  // 页面处理函数--监听页面滚动(not-nvue)
  // onPageScroll(event) {},
  // 页面处理函数--用户点击右上角分享
  // onShareAppMessage(options) {},
} 
</script>

<style scoped>
</style>